//
//  DZNavigationController.m
//  Weico
//
//  Created by 大泽 on 15/7/21.
//  Copyright (c) 2015年 刘洪泽. All rights reserved.
//

#import "DZNavigationController.h"

@interface DZNavigationController ()

@end

@implementation DZNavigationController

+ (void)initialize
{
    UIBarButtonItem *bar = [UIBarButtonItem appearance];
    
    NSMutableDictionary *normalAttr = [NSMutableDictionary dictionary];
    
    normalAttr[NSFontAttributeName] = [UIFont systemFontOfSize:14];
    normalAttr[NSForegroundColorAttributeName] = [UIColor orangeColor];
    
    [bar setTitleTextAttributes:normalAttr forState:UIControlStateNormal];
    
    
    NSMutableDictionary *disableAtts = [NSMutableDictionary dictionary];
    disableAtts[NSFontAttributeName] = [UIFont systemFontOfSize:14];
    disableAtts[NSForegroundColorAttributeName] = [UIColor grayColor];
    
    [bar setTitleTextAttributes:disableAtts forState:UIControlStateDisabled];
}


- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    if (self.viewControllers.count > 0) {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarger:self action:@selector(pop) title:nil image:@"navigationbar_back" highImage:@"navigationbar_back_highlighted"];
        viewController.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarger:self action:@selector(more) title:nil image:@"navigationbar_more" highImage:@"navigationbar_more_highlighted"];
        
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
    
 
}

- (void)pop
{
    [self popViewControllerAnimated:YES];
}

- (void)more{
    
    [self popToRootViewControllerAnimated:YES];
}

@end
